package com.cn.yds.bdy.controller;

import com.cn.yds.bdy.dao.DictionaryRepository;
import com.cn.yds.bdy.dao.model.DictionaryModel;
import com.cn.yds.bdy.vo.ResponseResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("dic")
public class DicController {

    @Autowired
    private DictionaryRepository dictionaryRepository;

    @RequestMapping(value = "topicTypes", method = RequestMethod.GET)
    public ResponseResult getDicList(){
        List<DictionaryModel> byType = dictionaryRepository.findByType(1);
        return ResponseResult.ok(byType);
    }

    @RequestMapping(value = "topicStatus", method = RequestMethod.GET)
    public ResponseResult topicStatus(){
        List<DictionaryModel> byType = dictionaryRepository.findByType(2);
        return ResponseResult.ok(byType);
    }
}
